
/** Readable Function defines **/
#define F_SET_LED 101
#define FUNCTION_SENSOR 102
#define FUNCTION_TIMER 103
#define F_ERROR 255


void functionTable(int funcID, int numArgs, int scope, XBeeAddress64 sender) 
{
  switch (funcID) 
  {
    case F_SET_LED:
      if ( Lithne.hasScope(scope) ) // Check if we are in the scope of the message. This is defined by the groups that we are a member of
      {
        if (numArgs == 1) { // In the processing example a counter sends values from 1 - 4
          int value = Lithne.getArgument(0);
          if (value == 0 || value == 1 || value == 3) { digitalWrite(13, HIGH); }
          else { digitalWrite(13, LOW); }
        }
        else if (numArgs == 2) { // In the processing example the x and y coordinates are sent
          int xValue = Lithne.getArgument(0);
          if (xValue > 127) { digitalWrite(13, HIGH); }
          else { digitalWrite(13, LOW); }
        }
      }
    break;
    default:
//      Serial.print("Unknown Func: ");
//      Serial.print( funcID, DEC );
//      Serial.print(", args: ");
//      for (int i = 0; i < arguments.length; i++) 
//      {
//        Serial.print(arguments[i], DEC); 
//        Serial.print(", "); 
//      }
//      Serial.print("for scope");
//      Serial.println(scope, DEC);
    break;
  }
}
